# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-language-server
pkgver=0.36.2
pkgrel=3
pkgdesc="implementation of the Language Server Protocol for Python"
url="https://github.com/palantir/python-language-server"
arch="noarch"
license="MIT"
depends="
	py3-jedi
	py3-jsonrpc-server
	py3-parso
	py3-pluggy
	py3-pydocstyle
	py3-ujson>=3.0.0
	py3-wheel
	python3
	"
makedepends="py3-setuptools"
checkdepends="
	py3-autopep8
	py3-coverage
	py3-flaky
	py3-matplotlib
	py3-mccabe
	py3-mock
	py3-numpy
	py3-pandas
	py3-pycodestyle
	py3-pyflakes
	py3-pylint
	py3-pytest
	py3-pytest-cov
	py3-python-versioneer
	py3-qt5
	py3-rope
	py3-yapf
	"
source="https://github.com/palantir/python-language-server/archive/$pkgver/python-language-server-$pkgver.tar.gz
	bump-jedi-compatibility.patch
	"
builddir="$srcdir/python-language-server-$pkgver"

case "$CARCH" in
	# Missing checkdepends: py3-qt5
	armhf) options="$options !check" ;;
esac

build() {
	python3 setup.py build
}

check() {
	# deselect'ed tests are broken
	#
	# test_numpy_hover broken with py3-numpy>=1.20.0
	# https://github.com/palantir/python-language-server/issues/906
	#
	# test_folding is broken on Python 3.9
	pytest -v \
		--deselect test/plugins/test_flake8_lint.py \
		--deselect test/plugins/test_pylint_lint.py \
		--deselect test/plugins/test_pyflakes_lint.py::test_syntax_error_pyflakes \
		-k "not test_numpy_hover and not test_snippet_parsing and not test_jedi_completion_environment and not test_symbols_all_scopes_with_jedi_environment and not test_folding"
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="5a1dec2e81e8486bf9a382fb87ed6ee7ed39e25d84470f5dfefc522214dc311cbdf97a509939f937763647a25b9d290c30bb1644e370117c65bd85276c762d4f  python-language-server-0.36.2.tar.gz
804308c6ce4d6189bf65f33397550d10b848e109a7f547f4bda80e9a78b68921225369667d9c72c3dbb954bda8a35af038596fac3b4ae026f952776f9bbb2c16  bump-jedi-compatibility.patch"
